{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 7.8 Laminar flow in Valves, Fittings, and Pipe - SAE oil through a pipe and globe valve"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": false
   },
   "source": [
    "S.A.E. 30 Oil at 40 degrees Celsius and a flow rate of 600 barrels/hour flows in a 60 m long 200 mm schedule 40 pipe and passes through a 200 mm globe valve, full area seat.\n",
    "\n",
    "Calculate the pressure drop."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "4575.571013232576 pascal"
      ],
      "text/latex": [
       "$4575.571013232576\\ \\mathrm{pascal}$"
      ],
      "text/plain": [
       "4575.571013232576 <Unit('pascal')>"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "from fluids.units import *\n",
    "from thermo import Stream\n",
    "from math import *\n",
    "Q = 600*u.barrel/u.hour\n",
    "L = 60*u.m\n",
    "NPS, D_pipe, Do_pipe, t = nearest_pipe(Di=200*u.mm)\n",
    "\n",
    "rho = 869.2*u.kg/u.m**3\n",
    "mu = 130*u.cP\n",
    "\n",
    "V = Q/(pi/4*D_pipe**2)\n",
    "Re = Reynolds(D=D_pipe, V=V, rho=rho, mu=mu)\n",
    "fd = friction_factor(Re=Re)\n",
    "ft = friction_factor(Re=1E6, eD=0.0018*u.inch/D_pipe)\n",
    "K = K_globe_valve_Crane(D1=D_pipe, D2=D_pipe, fd=ft)\n",
    "K += K_from_f(fd=fd, L=L, D=D_pipe)\n",
    "dP_from_K(K=K, V=V, rho=rho)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "collapsed": true
   },
   "source": [
    "The example gives a pressure drop of 6382 Pa."
   ]
  }
 ],
 "metadata": {
  "language_info": {
   "name": "python"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
